﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

public partial class Admin_ThemCD : System.Web.UI.Page
{
    ClassPhim cp = new ClassPhim();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] != null)
        {
            DropDownList1.DataSource = cp.TheLoaiCD();
            DropDownList1.DataTextField = "TenLoai";
            DropDownList1.DataValueField = "MaLoai";
            DropDownList1.DataBind();

            DropDownList2.DataSource = cp.TheLoaiPhim();
            DropDownList2.DataTextField = "TenTL";
            DropDownList2.DataValueField = "MaTL";
            DropDownList2.DataBind();
        }
        else
            Response.Redirect("DangNhap.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ten = Path.GetFileName(File1.PostedFile.FileName);
        File1.PostedFile.SaveAs(Server.MapPath("../Pictures/CD/" + ten));

        cp.ThemCD(TextBox1.Text,int.Parse(DropDownList1.SelectedValue),int.Parse(DropDownList2.SelectedValue),
                   TextBox2.Text,int.Parse(TextBox3.Text),int.Parse(TextBox4.Text),ten,TextBox5.Text,int.Parse(TextBox6.Text),TextBox8.Text );
    }
}
